#include "qfonteditor.h"

#include "../property/qabstractproperty.h"

#include <QFontDialog>

QFontEditor::QFontEditor(QAbstractProperty *property,QWidget *parent):
    QButtonCommonEditor(property,parent)
{
}

void QFontEditor::btn_clicked()
{
    QFont f=m_property->get_value().value<QFont>();

    bool ok;
    QFont font=QFontDialog::getFont(&ok,f,this,tr("Set Font"));
    if(ok)
    {
        if(f!=font)
        {
            QVariant v;
            v.setValue<QFont>(font);
            emit property_changed(v);
        }
    }
}

qRegisterPropertyEditor("Font",QFontEditor)
